/* 
 * File:   Application.h
 * Author: cjjonker
 *
 * Created on 20 december 2012, 15:03
 */

#ifndef APPLICATION_H
#define	APPLICATION_H

#include <GL/glui.h>
#include "Simulation.h"
#include "Visualization.h"

class Application {
    static const float hsvmin = 0.0;
    static const float hsvmax = 1.0;
        
    static const int levelmin = 2;
    static const int levelmax = 255;
        
    static const int clampFunction = GLUI_LIMIT_CLAMP;
    
    static const float clampMin = 0;
    static const float clampMax = 20;
    
    // Minimal distance between user set clampMin and clampMax < 0.1 = ERROR!
    static const float clampRange = 0.5;
    
    enum UiControlID
    {
        QuitButton,
        PauseButton,
        SeedButton
    };

    
    
    public:
        Application();
        virtual ~Application();
        static void initialize(int *argc, char** argv);
        static void initUI();
        static void outputUsage();		
        static void display();
        static void update();
        static void reshape(int w, int h);						// Handle window resizing (reshaping) events
        static void keyboard(unsigned char key, int x, int y);	// Handle key presses
        static void drag(int mx, int my);						// Handle mouse drag
        static void visualize();		
        static void quit();
        static void pause();
        static void buttonHandler(int id);
        static void mouseHandler(int button, int state, int x, int y);
        
        //GUI handlers
        static void drawItCheckBoxHandler(int id);
        static void colorModeListboxHandler(int id);
        static void scaleModeListboxHandler(int id);
        static void colorMapDatasetListboxHandler(int id);
        static void datasetListboxHandler(int id);
        static void appearanceListboxHandler(int id);
        static void valSpinnerHandler(int id);
        static void satSpinnerHandler(int id);
        static void hueSpinnerHandler(int id);
        static void levelSpinnerHandler(int id);
        static void normalizeCheckboxHandler(int id);
        static void clampMaxSpinnerHandler(int id);
        static void clampMinSpinnerHandler(int id);
        static void vectorScaleSpinnerHandler(int id);
        
        

    private:
        static int winWidth, winHeight;
        static bool setSeed;
        static GLUI *glui;
        static int main_window;
        static void setWidgets();
        static void setHSVGray();
        
        //GUI setup functions
        static GLUI_Listbox *makeListboxFromVector(std::vector<std::string> vec, std::string name, int id, GLUI_Panel *panel, GLUI_Update_CB callBack);
        static void setHSVSpinners();
        
        static Simulation simulation;			// the smoke simulation
        static Visualization visualization;
        
};

#endif	/* APPLICATION_H */

